/**
 * 修改appUser 绑定状态
 */
function updateBindStatus(id, enable) {
	$.post(PATH + "/updateBindStatus.do", {
		enable : enable,
		id : id
	}, function(data) {
		if (data != null) {
			if (data.ret == "0") {
				top.layer.msg('删除成功.......', {
					time : 1000,
					icon : 6
				});
			} else {
				top.layer.alert('删除失败....' + data.msg, {
					skin : 'layui-layer-lan',
					closeBtn : 0,
					anim : 4,
					icon : 5
				});
			}
		}
	});
}

//获取AppUser昵称
function getUserNickName(id,ywid){
	$.post(PATH + "/getUserNickName.do", {
		ywid : ywid
	}, 
	function(data) {
		if (data != null) {
			$("#nickname_"+id).html(data);
		}else{
		}
	},"text");
}
//获取Sys_User帐号
function getUserName(id,uid){
	$.post(PATH + "/getUserName.do", {
		uid : uid
	}, 
	function(data) {
		if (data != null) {
			$("#username_"+id).html(data);
		}else{
		}
	},"text");
}
/**
 *绑定删除
 */
function Delete(nowTr, id) {
	if (confirm("删除不可恢复，您确定要删除吗？")) {
		$.post(PATH + "/bindYWIdDelete.do", {
			id : id
		}, function(data) {
			if (data != null) {
				if (data.ret == "0") {
					$(nowTr).parent().parent().remove();
					top.layer.msg('删除成功.......', {
						time : 1000,
						icon : 6
					});
				} else {
					top.layer.alert('删除失败....' + data.msg, {
						skin : 'layui-layer-lan',
						closeBtn : 0,
						anim : 4,
						icon : 5
					});
				}
			}
		});
	}
}


function queryUserByUID(tid,id){
	$.post(PATH+"/api/queryUserNameByUID.do", {
		uid:id
	}, function(data) {
			if(data!=null){
				if(data.ret==0){
					$("#td_"+tid).html(data.data);
				}else{
					$("#td_"+tid).html(data.msg);
				}
			}
	});
}

function queryUserByUIDForInput(tid,id){
	$.post(PATH+"/api/queryUserNameByUID.do", {
		uid:id
	}, function(data) {
			if(data!=null){
				if(data.ret==0){
					$("#"+tid).val(data.data);
				}else{
					$("#"+tid).val(data.msg);
				}
			}
	});
}

function remove(id,type){
	var flag = confirm("确认删除此数据吗?");
	if(flag){
		window.location.href = "userRmove.do?uid="+id+"&status=1&type="+type;
	}
}

function setRole(id){
	window.location.href = "assignationMenuRole.do?uid="+id;
}

function search(){
	var status = $("#status").val();
	window.location.href = "articleList.do?isdelete="+status;
}

function searchBindYW(id){
	var status = $("#status").val();
	window.location.href = "bindYWIdList.do?id="+id+"&status="+status;
}